@import '../style/variable';
@import '../style/mixin';

#settings {
  @include overflow-auto(y);
  .separator {
    height: 10px;
  }
  .text {
    padding: $padding;
    color: var(--accent);
    font-size: $font-size-s;
  }
  .select,
  .range,
  .color {
    cursor: pointer;
  }
  .select .head,
  .switch,
  .range .head,
  .color .head {
    padding: $padding;
    background: var(--darker-background);
    font-size: $font-size;
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
    color: var(--primary);
    margin-top: -1px;
  }
  .select .head,
  .range .head,
  .color .head {
    transition: background $anim-duration, color $anim-duration;
    span {
      float: right;
    }
    &:active {
      background: var(--highlight);
      color: var(--select-foreground);
    }
  }
  .color .head span {
    display: inline-block;
    border: 1px solid var(--border);
    width: 15px;
    height: 15px;
  }
  .select ul {
    display: none;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
    &.open {
      display: block;
    }
    li {
      padding: $padding;
      transition: background $anim-duration, color $anim-duration;
      &:active {
        background: var(--highlight);
        color: var(--select-foreground);
      }
    }
  }
  .color ul {
    display: none;
    padding: $padding;
    font-size: 0;
    border-bottom: 1px solid var(--border);
    &.open {
      display: block;
    }
    li {
      display: inline-block;
      width: 20px;
      border: 1px solid var(--border);
      height: 20px;
      margin-right: 10px;
    }
  }
  .range .input-container {
    display: none;
    padding: $padding;
    border-bottom: 1px solid var(--border);
    position: relative;
    &.open {
      display: block;
    }
    .range-track {
      height: 4px;
      width: 100%;
      padding: 0 $padding;
      position: absolute;
      left: 0;
      top: 16px;
      .range-track-bar {
        background: var(--darker-background);
        border-radius: 2px;
        overflow: hidden;
        width: 100%;
        height: 4px;
        .range-track-progress {
          height: 100%;
          background: var(--accent);
          width: 50%;
        }
      }
    }
    input {
      -webkit-appearance: none;
      background: transparent;
      height: 4px;
      width: 100%;
      position: relative;
      top: -3px;
      margin: 0 auto;
      outline: none;
      border-radius: 2px;
    }
    input::-webkit-slider-thumb {
      -webkit-appearance: none;
      position: relative;
      top: 0px;
      z-index: 1;
      width: 16px;
      border: none;
      height: 16px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: radial-gradient(
        circle at center,
        var(--dark) 0,
        var(--dark) 15%,
        var(--light) 22%,
        var(--light) 100%
      );
    }
  }
  .switch {
    .checkbox {
      float: right;
      position: relative;
      vertical-align: top;
      width: 46px;
      height: 20px;
      padding: 3px;
      border-radius: 18px;
      border: 1px solid var(--border);
      cursor: pointer;
      background-image: linear-gradient(
        to bottom,
        var(--dark),
        var(--light) 25px
      );
      .input {
        position: absolute;
        top: 0;
        left: 0;
        opacity: 0;
      }
      .label {
        pointer-events: none;
        position: relative;
        display: block;
        height: 12px;
        font-size: 10px;
        text-transform: uppercase;
        background: var(--darker-background);
        border-radius: inherit;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12),
          inset 0 0 2px rgba(0, 0, 0, 0.15);
        transition: 0.15s ease-out;
        transition-property: opacity background;
        &:before,
        &:after {
          position: absolute;
          top: 50%;
          margin-top: -0.5em;
          line-height: 1;
          transition: inherit;
        }
      }
      .input:checked ~ .label {
        background: var(--accent);
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15),
          inset 0 0 3px rgba(0, 0, 0, 0.2);
      }
      .input:checked ~ .label:before {
        opacity: 0;
      }
      .input:checked ~ .label:after {
        opacity: 1;
      }
      .handle {
        position: absolute;
        pointer-events: none;
        top: 0;
        left: 0;
        width: 18px;
        height: 18px;
        border-radius: 10px;
        box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
        background-image: linear-gradient(
          to bottom,
          var(--light) 40%,
          var(--dark)
        );
        transition: left 0.15s ease-out;
      }
      .handle:before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        margin: -6px 0 0 -6px;
        width: 12px;
        height: 12px;
        border-radius: 6px;
        box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
        background-image: linear-gradient(to bottom, var(--dark), var(--light));
      }
      .input:checked ~ .handle {
        left: 30px;
        box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
      }
    }
  }
}
